package top.lc951.myandroid.views.card3;

import android.content.Context;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;

import com.bumptech.glide.Glide;

import top.lc951.bannerview2.holder.ViewHolder;
import top.lc951.myandroid.R;
import top.lc951.myandroid.model.CardOverlayModel;

public class CardOverlayViewHolder implements ViewHolder<CardOverlayModel> {

    private Context context;


    public CardOverlayViewHolder(Context context) {
        this.context=context;
    }

    @Override
    public int getLayoutId() {
        return R.layout.live_banner_viewpager_item;
    }

    @Override
    public void onBind(View itemView, CardOverlayModel data, int position, int size) {
        ImageView imageView = itemView.findViewById(R.id.card_iv);

        if(!TextUtils.isEmpty(data.getCoverUrl())){
            Glide.with(context)
                    .load(data.getCoverUrl())
                    .error(R.mipmap.ic_img02)
                    .placeholder(R.mipmap.ic_img01)
                    .into(imageView);
        }
    }
}
